<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCourierTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('courier', function (Blueprint $table) {
            $table->increments('id');
            $table->string('phone')->index()->comment('手机号');
            $table->string('password')->comment('密码');
            $table->string('name')->comment('姓名');
            $table->string('work_number')->nullable()->comment('工号');
            $table->unsignedTinyInteger('reg_type')->default(0)->comment(' 注册来源    0站点创建');
            $table->unsignedInteger('service_id')->index()->comment('服务站ID');
            $table->unsignedTinyInteger('jurisdiction')->default(1)->comment('权限  0入库  1派件  2入库、派件');
            $table->unsignedTinyInteger('is_authentication')->default(0)->comment(' 状态    0未认证   1已认证');
            $table->unsignedTinyInteger('work_status')->default(1)->comment('1:上班  0：未上班');
            $table->decimal('delivery_commission', 10, 2)->default(0.00)->comment('入库佣金');
            $table->decimal('send_commission', 10, 2)->default(0.00)->comment('派件佣金');
            $table->decimal('income', 10, 2)->default(0.00)->comment('收入');
            $table->decimal('amount', 10, 2)->default(0.00)->comment('余额');
            $table->unsignedInteger('delivery_num')->default(0)->comment('入库(件)');
            $table->unsignedInteger('send_num')->default(0)->comment('派件(件)');
            $table->string('avatar')->nullable()->comment('头像');
            $table->unsignedTinyInteger('status')->default(1)->comment('1:正常  2：禁用');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('courier');
    }
}
